package com.woniu.been.entity;

import com.woniu.tools.CourseTreeBuilder;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;

import java.util.ArrayList;
import java.util.List;

@Data
@AllArgsConstructor
@NoArgsConstructor
public class CategoryNode {
    private String categoryName;
    private List<CourseTreeBuilder.StageNode> stages = new ArrayList<>();
    private Double totalPrice = 0.0;

    public CategoryNode(String categoryName) {
        this.categoryName = categoryName;
    }

    // 添加阶段并累加总价
    public void addStage(CourseTreeBuilder.StageNode stage) {
        this.stages.add(stage);
        this.totalPrice += stage.getTotalPrice();
    }

    // getters
    public String getCategoryName() { return categoryName; }
    public List<CourseTreeBuilder.StageNode> getStages() { return stages; }
    public Double getTotalPrice() { return totalPrice; }
}
